import 'package:flutter/material.dart';

// 封装确定弹框
Future<bool?> customShowDialog(BuildContext context, {
  String? title = '',
  required String tipText,
  String? confirmText = '确定',
  String? cancelText = '取消',
}) {
  return showDialog<bool>(
    context: context,
    builder: (BuildContext context) {
      return AlertDialog(
        title: title == '' || title == null ? null : Text(title),
        content: Text(tipText),
        actions: <Widget>[
          TextButton(
            style: TextButton.styleFrom(
              textStyle: Theme.of(context).textTheme.labelLarge,
            ),
            child: Text(cancelText!),
            onPressed: () {
              Navigator.pop(context, false);
            },
          ),
          TextButton(
            style: TextButton.styleFrom(
              textStyle: Theme.of(context).textTheme.labelLarge,
            ),
            child: Text(confirmText!),
            onPressed: () {
              Navigator.pop(context, true);
            },
          ),
        ],
      );
    },
  );
}